package com.yuchao.base.xyc01;

/**
 * Hello world!
 *
 * 测试阻塞队列实现执行链模式
 *
 */
public class App{

    static IRequestProcessor requestProcessor;

    public void setUp(){
        PrintProcessor printProcessor=new PrintProcessor();
        printProcessor.start();
        SaveProcessor saveProcessor=new SaveProcessor(printProcessor);
        saveProcessor.start();

        requestProcessor=new PrevProcessor(saveProcessor);
        ((PrevProcessor) requestProcessor).start();
    }



    public static void main(String[] args) throws InterruptedException {
        App app=new App();
        app.setUp();
        Request request=new Request();
        request.setName("xingyuchao");
        requestProcessor.process(request);

        System.out.println("game over");
        Thread.sleep(5000);

        System.out.println("game start");
        request.setName("xingyuchao2");
        requestProcessor.process(request);
    }

}
